home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_2
/
scroll.men
< prev
next >
Wrap
Text File
|
1995-03-23
|
12KB
|
268 lines
Article 1674 of comp.sys.handhelds:
Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!samsung!zaphod.mps.ohio-state.edu!mips!bridge2!jarthur!dwalton
From: dwalton@jarthur.Claremont.EDU (Dave Walton)
Newsgroups: comp.sys.handhelds
Subject: Re: STRING->CODE in ASC Format
Summary: Scrollable menu utility for HP48SX
Keywords: MENU SCROLL
Message-ID: <8917@jarthur.Claremont.EDU>
Date: 7 Oct 90 00:30:09 GMT
References: <8034@helios.TAMU.EDU>
Organization: Harvey Mudd College, Claremont, CA 91711
Lines: 252
Here's a program that creates a scrollable menu facility on the HP48SX.
It's easy to edit, so can be taylored to many uses. See the comments
below for more info.
There's also a demo file below the main program that shows how to use
the SCRL program from inside another program (though it can be run
standalone)
%%HP: T(3)A(R)F(.);
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ @
@ Name: SCRL (size 1951.5, checksum #17721d) @
@ @
@ Description: This program is a scrollable menu program. It can be @
@ called externally from another program (see SCRL.DMO)@
@ or it can be made into a standalone program. Right @
@ now, the program is written for values of the form @
@ :TAG:VALUE. When the value is displayed on the lcd, @
@ only TAG:VALUE is displayed. And when the value is @
@ pushed onto the stack, the full :TAG:VALUE is pushed,@
@ but only TAG:VALUE shows up. For example, if you @
@ push :DEMOTAG:123 onto the stack, only DEMOTAG:123 @
@ shows up. Then if you press '3 -' then the tag is @
@ stripped off, and 120 is the result. Play around @
@ with it. You'll get the idea. Anyway, the program @
@ can easily be modified to handle other types of data @
@ as I have indicated further on in the file. Also, @
@ I have defined the first function key as the 'push @
@ to stack' key and the last function key as 'exit'. @
@ It is pretty trivial to add different functions. @
@ Just look below! Well, that's about all. I hope @
@ this program is useful! If you have any comments, @
@ contact me at my net address below. @
@ @
@ Arguments: NONE @
@ @
@ History: 01-OCT-90 -Dave Walton- Original coding. @
@ @
@ Address: dwalton@@jarthur.claremont.edu @
@ (use only one 'at') @
@ @
@ About the author: Dave Walton is a Junior at Havey Mudd College @
@ and is pursuing a degree in general engineering. @
@ @
@ Payment: If you like this program, send $80,000 to me to cover @
@ my education!!! No just kidding, but a nice mail @
@ message would be appreciated! @
@ @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
\<<
@@@@@
@ If you were going to make a standalone menu program, place the
@ data HERE!!!! Eg:
@ { "TITLE" ":AAA:1" ":BBB:2:" ":CCC:3" }
@@@@@
0 0 \->
M @M --> Matrix containing all values (from stack)
MAX @MAX --> Total number of values
CURSOR @CURSOR --> Cursor grob
\<<
ERASE @Erase graphics screen
{ # 0d # 0d } PVIEW @Show graphics screen
PICT { # 0d # 0d } @Retrieve blank graphics screen to stack
M LIST\-> 1 - @Break up M and reform without first entry
\->LIST 'M' STO @ which is the title
M SIZE 'MAX' STO @Save size of M
" " @Set up cursor grob
2 \->GROB NEG
'CURSOR' STO
2 \->GROB REPL @Title was on stack. Grob and put on screen
{ {"\->STK" } { "" } { @Set up temporary function menu
"" } { "" } { "" }
{ "EXIT" } } TMENU
1 1 9 9 0 \->
CURR @CURR --> Current VALUE
TOPR @TOPR --> VALUE currently at top position on lcd
POSR @POSR --> Position of CURR
TPOSR @TPOSR --> Temp position
KEYPRESS @KEYPRESS --> Key pressed by user
\<<
DO @Only update screen of KEYPRESS = 0
IF '
KEYPRESS==0'
THEN
9 'TPOSR' STO @Start from position 9
TOPR TOPR 4 + @Print values from TOPR to TOPR+4
FOR I
PICT # 0d TPOSR DUP @Push screen grob to stack and form coordinate
9 + 54 MOD 'TPOSR' @ list of where next value should go
STO R\->B 2 \->LIST @ Eg. { # 0d # 30d } will print at (0,30)
M I GET @Get I'th VALUE
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DUP SIZE 2 SWAP @Translate :TAG:VALUE to TAG:VALUE
SUB @ Modify this for different types of VALUE
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2 \->GROB REPL @Put VALUE on screen
NEXT
PICT # 0d POSR R\->B 2 @Place CURSOR on current VALUE
\->LIST CURSOR GXOR
END
-1 WAIT @Wait for a key press
FLOOR @Get integer part of value of key pressed
'KEYPRESS' STO @ and store it in KEYPRESS
IF ' @If key was 1st function key, push to stack
KEYPRESS==11'
THEN M CURR GET @Get current VALUE
STR\-> @Convert from string to value
END
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@The previous 'push to stack' could be modified for different types of
@ data. For example, if the user wanted the value of type string to
@ be coppied exactly (and as a string) to the stack, the code would look
@ like this:
@ ... THEN M CURR GET END...
@ Easy, huh?
@Also, here is where the rest of the function key declarations would go
@ where 12 --> function key 2,
@ 13 --> function key 3, etc.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IF ' @Up arrow
KEYPRESS==25'
THEN PICT @Push screen grob to stack
# 0d POSR R\->B 2 @Make current position
\->LIST CURSOR GXOR @Turn off cursor
IF 'CURR @If we're already at the first element,
==1'
THEN MAX @ then print last screen and place
'CURR' STO MAX 4 - @ cursor on last line.
'TOPR' STO 45
'POSR' STO 9
'TPOSR' STO 0 @Set KEYPRESS to 0 so that we go through the
'KEYPRESS' STO @ first loop again and print all values.
ELSE CURR
1 - 'CURR' STO POSR @If not at first value, decrement CURR and POSR
9 - 'POSR' STO
IF ' @If we're now above the first entry, shift the
POSR==0' @ screen down
THEN
IF '
TOPR\=/1'
THEN
TOPR 1 - 'TOPR' STO @Set new element for top of screen
PICT { # 0d # 18d } @Put position of where copied section WILL GO
PICT { # 0d # 9d } @Put position of where WILL COPY SECTION FROM
{ # 131d # 44d } @Put bottom right corner of where WILL COPY FROM
SUB @Move section
PICT { # 0d @Now put new row that we don't have yet onto
# 9d } M TOPR GET @ screen
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DUP SIZE 2 SWAP SUB @THIS LINE CONVERTS :TAG:VALUE to TAG:VALUE
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2 \->GROB REPL REPL
END 9
'POSR' STO
END
PICT # 0d POSR R\->B
2 \->LIST CURSOR GXOR @Put CURSOR on current VALUE
END
END
IF '
KEYPRESS==35' @Down arrow -- the logic is almost the same
THEN PICT @ as the Up arrow, so I won't comment
# 0d POSR R\->B 2 @ step by step. REMEMBER ABOUT THE
\->LIST CURSOR GXOR @ CONVERSION FROM :TAG:VALUE to TAG:VALUE!!!
IF 'CURR
==MAX'
THEN 1
'CURR' STO 1 'TOPR'
STO 9 'POSR' STO 9
'TPOSR' STO 0
'KEYPRESS' STO
ELSE CURR
1 + 'CURR' STO POSR
9 + 'POSR' STO
IF '
POSR==54'
THEN
IF '
TOPR+4\=/MAX'
THEN
TOPR 1 + 'TOPR' STO
PICT { # 0d # 9d }
PICT { # 0d # 18d }
{ # 131d # 53d }
SUB PICT { # 0d
# 45d } M TOPR 4 +
GET DUP SIZE 2 SWAP
SUB 2 \->GROB REPL
REPL
END
45 'POSR' STO
END
PICT # 0d POSR R\->B
2 \->LIST CURSOR GXOR
END
END
UNTIL ' @Keep on doing all of this until EXIT is pressed
KEYPRESS==16'
END
ERASE @Erase graphics screen
0 MENU @Restore menu that was there before
\>> @ execution began
\>>
\>>
%%HP: T(3)A(R)F(.);
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ @
@ Name: SCRL.DMO @
@ @
@ Description: This is a demo program for the program SCRL. It @
@ contains all of the SI prefixes. This demo shows @
@ how the SCRL program can be used internally from @
@ other programs to create scrollable menues. There @
@ is also the option of putting the definitions in @
@ the MENU program itself making it standalone. The @
@ format of the list should be the following: @
@ TITLE (to be displayed at top line of lcd @
@ VALUE1 @
@ VALUE2 (make sure that all entries have the @
@ ... same length so that no stray @
@ VALUEn characters are left over) @
@ With a few modifications, the SCRL program can @
@ handle many different types of data and perform @
@ many different functions. @
@ @
@ Arguments: NONE @
@ @
@ History: 01-OCT-90 -Dave Walton- Original coding. @
@ @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
\<< {
" SI Prefixes" @ TITLE
":deka:1E1 " @ VALUE1
":hecto:1E2 " @ VALUE2, etc.
":kilo:1E3 "
":mega:1E6 "
":giga:1E9 "
":tera:1E12 "
":peta:1E15 "
":exa:1E18 "
":deci:1E-1 "
":centi:1E-2 "
":milli:1E-3 "
":micro:1E-6 "
":nano:1E-9 "
":pico:1E-12 "
":femto:1E-15"
":atto:1E-18 " }
SCRL @ Invoke MENU program
\>>